<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="Bookmark" href="/icon/favicon.ico" >
    <link rel="Shortcut Icon" href="/icon/favicon.ico" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="lib/html5shiv.js"></script>
    <script type="text/javascript" src="lib/respond.min.js"></script>

    <![endif]-->
    <link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css" />

    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <!--/meta 作为公共模版分离出去-->

    <link href="lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="page-container">
    <form name="product-add" action="" method="post" class="form form-horizontal" id="product-add">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">商品名称：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span id="title"></span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">简介：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span id="introduction"></span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">商品分类：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span id="cname"></span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">标签：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span id="tag"></span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">商品价格：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span id="price"></span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">库存数量：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span id="num"></span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">库存不足提醒额度：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span id="remindNum"></span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">创建人：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span id="createBy"></span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">创建时间：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span id="createTime"></span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">上架时间：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span id="saleDate"></span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">促销价：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span id="promotionPrice"></span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">促销时间：</label>
            <div class="formControls col-xs-8 col-sm-9" id="promotionDate">
                <span id="promotionDateFrom"></span> - <span id="promotionDateTo"></span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">商品封面：</label>
            <div class="formControls col-xs-11 col-sm-12" style="margin-top: -16px;margin-left: 170px;">
                <img src="" id="cover" width="200px" height="200px" style="margin-right: 10px;margin-bottom:10px">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">商品相册：</label>
            <div class="formControls col-xs-11 col-sm-12" style="margin-top: -16px;margin-left: 170px;" id="image">

            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">商品详情：</label>
            <div class="formControls col-xs-8 col-sm-9" id="detail">
            </div>
        </div>
    </form>
</div>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="lib/webuploader/0.1.5/webuploader.min.js"></script>
<link rel="stylesheet" href="lib/kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="lib/kindeditor/plugins/code/prettify.css" />
<script charset="utf-8" src="lib/kindeditor/kindeditor.js"></script>
<script charset="utf-8" src="lib/kindeditor/lang/zh-CN.js"></script>
<script charset="utf-8" src="lib/kindeditor/plugins/code/prettify.js"></script>
<script type="text/javascript">
    var index = layer.load(3);
    $(function () {
        $.ajax({
            type: 'GET',
            url: '/item/view/'+parent.getId(),
            dataType: 'json',
            success: function(data){
                layer.close(index);
                $("#title").html(data.result.title);
                $("#introduction").html(data.result.introduction);
                $("#price").html(data.result.price + " 元");
                $("#num").html(data.result.num + " 件");
                $("#remindNum").html(data.result.remindNum + " 件");
                $("#cname").html(data.result.cname);
                $("#cid").html(data.result.cid);
                if (data.result.tag == 0){
                    $("#tag").html("促销");
                } else{
                    $("#tag").html("新品");
                }

                $("#saleDate").html(data.result.saleDate);
                $("#createBy").html(data.result.createUsername);
                $("#createTime").html(data.result.createTime);
                if (data.result.promotionPrice){
                    $("#promotionPrice").html(data.result.promotionPrice + " 元");
                }else{
                    $("#promotionPrice").html("--");
                }

                if(data.result.promotionDateFrom && data.result.promotionDateTo){
                    $("#promotionDateFrom").html(data.result.promotionDateFrom);
                    $("#promotionDateTo").html(data.result.promotionDateTo);
                }else{
                    $("#promotionDate").html("--");
                }

                $("#cover").attr("src",data.result.cover);
                var images= new Array();
                images=data.result.image.split(",");
                var img='';debugger;
                for(var i=0;i<images.length;i++){
                    img += '<img src="'+images[i]+'" width="200px" height="200px" style="margin-right: 10px;margin-bottom:10px"/>';
                }
                $("#image").html(img);
                if (data.result.detail) {
                    $("#detail").html(data.result.detail)
                }else{
                    $("#detail").html("--")
                }

            },
            error:function(XMLHttpRequest) {
                layer.close(index);
                layer.alert('数据处理失败! 错误码:'+XMLHttpRequest.status+' 错误信息:'+JSON.parse(XMLHttpRequest.responseText).message,{title: '错误信息',icon: 2});
            },
        });
    })




</script>
</body>
</html>
